#!/bin/bash
set -e
set -x
MYDIR="${0%/*}"
cd "$MYDIR/.."
source "recipes/common.sh"


# RECIPE START Python
#
# XXX: python build system uses python. For a native build a bootstrap
# python is compiled for that, for a cross-compilation an external python
# is required (of the exactly same version as the one being cross-compiled)
#
# depends: Python-native
# depends: cross-pkg-config
# depends: expat
# depends: gdbm
# depends: libffi
# depends: openssl1.1
# depends: readline
# depends: util-linux
# depends: xz
# depends: zlib

reset_mtime Python Python/configure.ac
rm -rf build/Python
mkdir -p build/Python
cd build/Python

env \
	ac_cv_buggy_getaddrinfo=no \
	ac_cv_file__dev_ptmx=yes \
	ac_cv_file__dev_ptc=no \
../../Python/configure \
	${CONFIGURE_ARGS} \
	--target=${TARGET} \
	--enable-shared \
	--with-platlibdir=${target_libdir} \
	--enable-ipv6 \
	--with-dbmliborder=gdbm \
	--with-system-expat \
	--with-system-ffi \
	--with-openssl-rpath=no \
	--enable-loadable-sqlite-extensions \
	--with-ssl-default-suites=openssl \
	--with-build-python="${xtools}${build_prefix}/bin/python3" \
	--without-ensurepip \
	${AUTOCRAP_KLUDGE}

cd ../..
make_build build/Python

# RECIPE END Python
